/*
 *  水题， 求和， 运用到数学的分配律， 负责会超时只能拿6分
 * */

#include <iostream>
using namespace std;

const int N = 200010;

int n;
long long a[N];

int main() {
    // 请在此输入您的代码
    cin >> n;

    long long sum = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        sum += a[i];
    }

    long long res = 0;

    for (int i = 1; i <= n; ++i) {
        sum -= a[i];
        res += a[i] * sum;
    }

    cout << res;

    return 0;
}